package org.walkerljl.boss.openservice;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.walkerljl.commons.log.Logger;
import org.walkerljl.commons.log.LoggerFactory;

/**
 * @author lijunlin
 */
public class OpenServiceServer {

    private static final Logger LOGGER = LoggerFactory.getLogger(OpenServiceServer.class);

    public static void main(String[] args) {
        long s = System.currentTimeMillis();
        LOGGER.info("[Boss-OpenService] server startup ...");

        try {
            new OpenServiceServer().start();
        } catch (Exception e) {
            LOGGER.error("[Boss-OpenService] server startup fail!", e);
            System.exit(1);
        }

        long e = System.currentTimeMillis();
        LOGGER.info("[Boss-OpenService] server start ... end, cost " + (e - s) + " ms");
        synchronized (OpenServiceServer.class) {
            while (true) {
                try {
                    OpenServiceServer.class.wait();
                } catch (InterruptedException ex) {
                }
            }
        }
    }

    private void start() {
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext(new String[]{"classpath:spring.xml"});
        context.start();
    }
}
